package books.room;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

import anime.room.HistoryModel;

@Dao
public  interface BooksHistoryDao {


    //添加  传递一个参数 对象
    @Insert
    void addHistoryDao(BooksHistoryModel historyModel);

    //添加  可以传递多个参数 对象
    @Insert
    void addsHistoryDao(BooksHistoryModel... historyModels);

    //删除
    @Delete
    int deleteHistory(BooksHistoryModel... historyModels);

    //修改 传入对象 设置 id 进行修改某一个
    @Update
    int updateHistory(BooksHistoryModel... historyModels);



    //根据id查询
    @Query("select * from BooksHistoryModel where id =:numb")
    BooksHistoryModel getHistoryId(Integer numb);

    //删除所有
    @Query("delete from BooksHistoryModel")
    void deleteTableData();

    //查询所有
    @Query("SELECT * FROM BooksHistoryModel")
    LiveData<List<BooksHistoryModel>> getAllSLive();

}
